<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>影像</title>
    <link href="./lib/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <link href="./lib/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

    <style>
        * {
            user-select: none;
        }
        html {
            width: 100%;
            height: 100%;
        }
        body {
            padding: 0;
            margin: 0;
            width: 100%;
            height: 100%;
            background-color: #ccc;
        }
        .container-fluid {
            height: 100%;
        }
        .nav {
            position: relative;
            width: 200px;
            height: 100%;
            background-color: #ccc;
        }
        .nav .img-container {
            position: relative;
            width: 100%;
            height: 100%;
            /*top: 115px;*/
            /*bottom: 0;*/
            overflow-y: auto;
            overflow-x: hidden;
        }
        .nav  .preview-img {
            width: 100%;
        }
        .canvas-container {
            position: absolute;
            top: 10px;
            left: 230px;
            right: 10px;
            bottom: 10px;
            border: 1px solid #C3B0C8;
        }
        .rotate-btn-container {
            position: absolute;
            top: 0;
            height: 100%;
            width: 50px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .rotate-btn-container.left {
            left: 10px;
        }
        .rotate-btn-container.right {
            right: 10px;
        }
        .rotate-btn {
            z-index: 2;
            width: 100%;
            height: 50px;
            position: relative;
            border-radius: 50%;
            background-color: #fff;
            font-size: 29px;
            outline: none !important;
            border: 2px solid #000;
            transition: all 1s;
        }
        .rotate-btn i {
            transition: all 100ms;
        }
        .rotate-btn.right :hover {
            transform: rotate(90deg);
        }
        .rotate-btn.left :hover {
            transform: rotate(-90deg);
        }
        .canvas-container {
            background-color: #fff;
            padding: 0;
        }
        
        canvas {
            position: relative;
            z-index: 1;
        }
    </style>
</head>
<body>
<div class="container-fluid">
   <div class="nav">
       <div class="img-container"></div>
   </div>
    <div id="canvas-container" class="canvas-container img-thumbnail">
        <div class="rotate-btn-container left">
            <button id="rotate-left-btn"  class="rotate-btn left">
                <i class="fa fa-rotate-left" aria-hidden="true"></i>
            </button>
        </div>
        <div class="rotate-btn-container right">
            <button id="rotate-right-btn" class="rotate-btn right">
                <i class="fa fa-rotate-right" aria-hidden="true"></i>
            </button>
        </div>
        <canvas id="canvas"></canvas>
    </div>
</div>
<script src="./js/jquery-3.4.1.min.js"></script>
<script src="./lib/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="./js/Utils.js"></script>
<script src="js/ImgPainter.js"></script>
<script src="js/ImgSprite.js"></script>
<script src="js/PosHandler.js"></script>
<script src="js/InitPos.js"></script>
<script src="./js/MouseEventHandler.js"></script>
<script>
    const drawer = new ImgPainter().init();
    const imgs = ['001.jpg', '0004.jpg', '004.jpg', '005.png', '006.jpg', '007.jpg', '008.jpg', '009.jpeg', '010.jpg'];
    const $imgsContainer = $('.img-container');
     $.each(imgs, (idx, item) => {
        let $img = $(`<img src="./img/${item}" data-src="./img/${item}" class="preview-img" alt="${item}"/>`);
        $imgsContainer.append($img);
     });
     $imgsContainer.on('click', 'img', function() {
        drawer.paint($(this).data('src'));
     });
    drawer.paint('./img/010.jpg');
</script>
</body>
</html>